package ru.ssau.university.persistence.dao;

import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;

import ru.ssau.hibernate.util.AbstractDAO;
import ru.ssau.university.persistence.entity.PlanItem;

public class PlanItemDAO extends AbstractDAO<PlanItem>{
	public PlanItemDAO() {
		this.objectClass = PlanItem.class;
	}

	@SuppressWarnings("unchecked")
	public List<PlanItem> getPlanItems(Long specId, int term) {
		Criteria c = createCriteria();
		c.add(Restrictions.eq("speciality.id", specId));
		c.add(Restrictions.eq("term", term));
		return (List<PlanItem>) c.list();
		
	}
}
